<template>
	<div class="u-page" style="background:#f7f7f7">
		<u-navbar :title="Navbar.title" :title-bold="true" title-color="#040503" back-icon-color="#040503"
			:custom-back="comeback" :background="Navbar.background" :border-bottom="false" title-width="380"></u-navbar>
		<section class="aui-flexView">
			<section class="aui-scrollView">
				<div class="aui-order-box">
					<div class="aui-flex-goodsbox aui-flex-default aui-mar15" @click="goToGoodsDetail">
						<div class="aui-flex-goods">
							<img :src="goods.goodsImages.split(',')[0]" alt="">
						</div>
						<div class="aui-flex-box">
							<h2>{{goods.goodsName}}</h2>
							<div class="goods-box-spec u-fz-13">{{goods.specification}}</div>
							<div class="aui-flex-clear">
								<div class="goods-box-price">￥{{goods.discountPrice}}</div>
							</div>
						</div>
					</div>

					<!-- 基本设置 -->
					<div class="aui-flex-default border-radius30">
						<div class="aui-flex aui-choice-white b-line u-center u-font-bold u-pt-15 u-pb-15">
							<u-divider color="#eb5468" fontSize="30" border-color="#eb5468">基本设置</u-divider>
						</div>
						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">活动名称</div>
							<u-input v-model="form.subject" input-align="right" placeholder="请填写活动名称" />
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">
								<div style="display: block;float: left;margin-right: 10rpx;">活动主图</div>
								<div class="Tips">
									<span style=" color: #f02323;"> *上传的图片默认排在最前，不上传即直接用商品主图</span>
								</div>
							</div>
						</div>
						<div class="aui-flex aui-choice-white b-line">
							<Upload u_appid="evaluation" u_fieldName="mainPicture" :u_orunid="form.id" u_type="0"
								:u_initialAttchments="mainPictureFiles" @receiveAttachmentsData="getMainPictureFiles">
							</Upload>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">标题标签</div>
							<!-- maxlength="4" -->
							<u-input v-model="form.label" input-align="right" placeholder="请填写标题标签"
								@blur="checkLabel($event)" />
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">活动名额</div>
							<u-input v-model="form.quota" type="number" input-align="right" placeholder="请填写活动名额" />
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">报名截止时间</div>
							<div class="aui-flex-triangle" @click="joinEndTime_show = true">
								<span v-if="form.joinEndTime">{{form.joinEndTime}}</span>
								<span v-else>请选择</span>
							</div>
							<u-picker v-model="joinEndTime_show" mode="time" @confirm="selectJoinEndTime($event)">
							</u-picker>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">提交成果周期(天)</div>
							<u-number-box :min="1" v-model="form.submitLimitDays"
								@change="calculateRatingDate"></u-number-box>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">活动结束时间</div>
							<div class="aui-flex-triangle" @click="endTime_Show = true">
								<span v-if="form.endTime">{{form.endTime}}</span>
								<span v-else>请选择</span>
							</div>
							<u-picker v-model="endTime_Show" mode="time" @confirm="selectEndTime($event)"></u-picker>
						</div>

						<div class="aui-flex aui-choice-white b-line aui-mar15">
							<div class="aui-flex-box">活动评级</div>
							<div class="aui-flex-triangle" @click="enableRating_show = true">
								<span>{{enableRating_text}}</span>
							</div>
							<u-select v-model="enableRating_show" :list="enableRatingRange"
								@confirm="selectEnableRating"></u-select>
						</div>

						<!-- 开启评级 -->
						<div v-if="form.enableRating == '1'">
							<div class="aui-flex aui-choice-white b-line">
								<div class="aui-flex-box">评级时间</div>
								<div class="aui-flex-triangle" @click="ratingTime_Show = true">
									<span v-if="form.ratingTime">{{form.ratingTime}}</span>
									<span v-else>请选择</span>
								</div>
								<u-picker v-model="ratingTime_Show" mode="time"
									@confirm="selectRatingTime($event)"></u-picker>
							</div>

							<div class="aui-flex aui-choice-white b-line">
								<div class="aui-flex-box">评级人员</div>
								<div class="aui-flex-triangle" @click="toSelectUsers('1')">
									<span>{{form.ratingMemberName}}</span>
								</div>
							</div>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">活动公开</div>
							<div class="aui-flex-triangle" @click="open_show = true">{{open_text}}
							</div>
							<u-picker mode="selector" v-model="open_show" :default-selector="[0]" :range="selectRange"
								@confirm="open_text = selectRange[$event]"></u-picker>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">验收人员</div>
							<div class="aui-flex-triangle" @click="toSelectUsers('0')">
								<span>{{form.inspectorName}}</span>
							</div>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">品牌推广客服</div>
							<div class="aui-flex-triangle" @click="CS_show = true">{{csNameText?csNameText:'请选择'}}
							</div>
							<u-select v-model="CS_show" :list="CSRange" @confirm="selectCS"></u-select>
						</div>

						<!-- 活动受众 -->
						<div class="aui-flex aui-choice-white b-line u-center u-font-bold u-pt-15 u-pb-15">
							<u-divider color="#eb5468" fontSize="30" border-color="#eb5468">活动受众</u-divider>
						</div>
						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">活动面向群体</div>
							<div class="aui-flex-triangle" @click="eventParticipants_show = true">
								<span v-if="eventParticipants_text">{{eventParticipants_text}}</span>
								<span v-else>请选择</span>
							</div>
							<u-picker mode="selector" v-model="eventParticipants_show" :default-selector="[1]"
								:range="eventParticipantsRange"
								@confirm="eventParticipants_text = eventParticipantsRange[$event]"></u-picker>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">等级要求</div>
							<div class="aui-flex-triangle" @click="restrictionLevel_show = true">
								{{restrictionLevel_text}}
							</div>
							<u-picker mode="selector" v-model="restrictionLevel_show" :default-selector="[0]"
								:range="restrictionLevelRange"
								@confirm="restrictionLevel_text = restrictionLevelRange[$event]"></u-picker>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">限制报名周期(天)</div>
							<div class="aui-flex-triangle" @click="joinLimitDays_show = true">{{joinLimitDays_text}}
							</div>
							<u-picker mode="selector" v-model="joinLimitDays_show" :default-selector="[0]"
								:range="joinLimitDaysRange"
								@confirm="joinLimitDays_text = joinLimitDaysRange[$event]"></u-picker>
						</div>

						<div class="aui-flex aui-choice-white b-line aui-mar15">
							<div class="aui-flex-box">提交收货信息</div>
							<div class="aui-flex-triangle" @click="submitConsigneeInfo_show = true">
								<span>{{submitConsigneeInfo_text}}</span>
							</div>
							<u-picker mode="selector" v-model="submitConsigneeInfo_show" :default-selector="[1]"
								:range="selectRange"
								@confirm="submitConsigneeInfo_text = selectRange[$event]"></u-picker>
						</div>

						<!-- 活动内容 -->
						<div class="aui-flex aui-choice-white b-line u-center u-font-bold u-pt-15 u-pb-15">
							<u-divider color="#eb5468" fontSize="30" border-color="#eb5468">活动内容</u-divider>
						</div>

						<div class="aui-flex aui-choice-white">
							<div class="aui-flex-box">推广任务</div>
						</div>
						<div class="aui-flex aui-choice-white b-line" style="padding-top: 0;">
							<div class="textarea-block">
								<u-input type="textarea" placeholder="请填写推广任务" maxlength="1000" height="300"
									:autoHeight="false" v-model="form.taskRequirements"></u-input>
							</div>
						</div>
						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">
								<div style="display: block;float: left;margin-right: 10rpx;">上传图片</div>
								<div class="Tips">
									<span style=" color: #f02323;">*选填</span>
								</div>
							</div>
						</div>
						<div class="aui-flex aui-choice-white b-line">
							<Upload u_appid="evaluation" u_fieldName="taskRequirements" :u_orunid="form.id" u_type="0"
								:u_initialAttchments="taskRequirementsFiles"
								@receiveAttachmentsData="getTaskRequirementsFiles"></Upload>
						</div>

						<div class="aui-flex aui-choice-white">
							<div class="aui-flex-box">验收标准</div>
						</div>
						<div class="aui-flex aui-choice-white b-line" style="padding-top: 0;">
							<div class="textarea-block">
								<u-input type="textarea" placeholder="请填写验收标准" maxlength="1000" height="300"
									:autoHeight="false" v-model="form.acceptanceCriteria"></u-input>
							</div>
						</div>
						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">
								<div style="display: block;float: left;margin-right: 10rpx;">上传图片</div>
								<div class="Tips">
									<span style=" color: #f02323;">*选填</span>
								</div>
							</div>
						</div>
						<div class="aui-flex aui-choice-white b-line">
							<Upload u_appid="evaluation" u_fieldName="acceptanceCriteria" :u_orunid="form.id" u_type="0"
								:u_initialAttchments="acceptanceCriteriaFiles"
								@receiveAttachmentsData="getAcceptanceCriteriaFiles"></Upload>
						</div>

						<!-- 活动报酬 -->
						<div class="aui-flex aui-choice-white b-line u-center u-font-bold u-pt-15 u-pb-15">
							<u-divider color="#eb5468" fontSize="30" border-color="#eb5468">活动报酬</u-divider>
						</div>

						<!-- 开启评级：需要评级发放奖励 -->
						<div v-if="form.enableRating == '1'">
							<div class="aui-choice-white b-line coupon-item">
								<div class="aui-flex-box-title">A级</div>
								<div class="aui-flex2">
									<div class="aui-flex-box">名额</div>
									<u-input v-model="form.levelAQuota" type="number" input-align="right"
										placeholder="请填写A级名额" @blur="checkQuota($event, 'A')" />
								</div>
								<div class="aui-flex2">
									<div class="aui-flex-box">现金报酬（￥）</div>
									<!-- @blur="checkMoney($event, 'A')" -->
									<u-input v-model="form.levelAReward" type="digit" input-align="right"
										placeholder="请填写A级报酬" @input="calculate()" />
								</div>
								<div class="aui-flex3">
									<div class="u-flex" style="width: 100%;">
										<div class="aui-flex-box">优惠券（￥）</div>
										<u-input v-model="form.levelACouponAmount" type="digit" input-align="right"
											placeholder="请填写优惠券金额" />
									</div>
									<div style="width: 100%;display: flex;flex-direction: row-reverse;">
										<u-radio-group v-model="couponA" @change="radioGroupChangeA"
											active-color="#eb5468">
											<u-radio v-for="(item, index) in couponList" :key="index" :name="item.name"
												:disabled="item.disabled">
												{{ item.name }}
											</u-radio>
										</u-radio-group>
									</div>
								</div>

								<div class="aui-flex4 aui-choice-white">
									<div class="aui-flex-box">评级标准</div>
								</div>
								<div class="aui-flex4 aui-choice-white b-line" style="padding-top: 0;">
									<div class="textarea-block">
										<u-input type="textarea" placeholder="请填写A级的评级标准" maxlength="1000" height="300"
											:autoHeight="false" v-model="form.levelARatingCriteria"></u-input>
									</div>
								</div>

							</div>

							<div class="aui-choice-white b-line coupon-item">
								<div class="aui-flex-box-title">B级</div>
								<div class="aui-flex2">
									<div class="aui-flex-box">名额</div>
									<u-input v-model="form.levelBQuota" type="number" input-align="right"
										placeholder="请填写B级名额" @blur="checkQuota($event, 'B')" />
								</div>
								<div class="aui-flex2">
									<div class="aui-flex-box">现金报酬（￥）</div>
									<!-- @blur="checkMoney($event, 'B')" -->
									<u-input v-model="form.levelBReward" type="digit" input-align="right"
										placeholder="请填写B级报酬" @input="calculate()" />
								</div>
								<div class="aui-flex3">
									<div class="u-flex" style="width: 100%;">
										<div class="aui-flex-box">优惠券（￥）</div>
										<u-input v-model="form.levelBCouponAmount" type="digit" input-align="right"
											placeholder="请填写优惠券金额" />
									</div>
									<div style="width: 100%;display: flex;flex-direction: row-reverse;">
										<u-radio-group v-model="couponB" active-color="#eb5468">
											<u-radio v-for="(item, index) in couponList" :key="index" :name="item.name"
												:disabled="item.disabled">
												{{ item.name }}
											</u-radio>
										</u-radio-group>
									</div>
								</div>

								<div class="aui-flex4 aui-choice-white">
									<div class="aui-flex-box">评级标准</div>
								</div>
								<div class="aui-flex4 aui-choice-white b-line" style="padding-top: 0;">
									<div class="textarea-block">
										<u-input type="textarea" placeholder="请填写B级的评级标准" maxlength="1000" height="300"
											:autoHeight="false" v-model="form.levelBRatingCriteria"></u-input>
									</div>
								</div>

							</div>

							<div class="aui-choice-white b-line coupon-item">
								<div class="aui-flex-box-title">C级</div>
								<div class="aui-flex2">
									<div class="aui-flex-box">名额</div>
									<u-input v-model="form.levelCQuota" disabled="true" type="number"
										input-align="right" placeholder="自动计算(总名额-A级名额-B级名额)"
										@blur="checkQuota($event, 'C')" />
								</div>
								<div class="aui-flex2">
									<div class="aui-flex-box">现金报酬（￥）</div>
									<!-- @blur="checkMoney($event, 'C')" -->
									<u-input v-model="form.levelCReward" type="digit" input-align="right"
										placeholder="请填写C级报酬" @input="calculate()" />
								</div>
								<div class="aui-flex3">
									<div class="u-flex" style="width: 100%;">
										<div class="aui-flex-box">优惠券（￥）</div>
										<u-input v-model="form.levelCCouponAmount" type="digit" input-align="right"
											placeholder="请填写优惠券金额" />
									</div>
									<div style="width: 100%;display: flex;flex-direction: row-reverse;">
										<u-radio-group v-model="couponC" active-color="#eb5468">
											<u-radio v-for="(item, index) in couponList" :key="index" :name="item.name"
												:disabled="item.disabled">
												{{ item.name }}
											</u-radio>
										</u-radio-group>
									</div>
								</div>

								<div class="aui-flex4 aui-choice-white">
									<div class="aui-flex-box">评级标准</div>
								</div>
								<div class="aui-flex4 aui-choice-white b-line" style="padding-top: 0;">
									<div class="textarea-block">
										<u-input type="textarea" placeholder="请填写C级的评级标准" maxlength="1000" height="300"
											:autoHeight="false" v-model="form.levelCRatingCriteria"></u-input>
									</div>
								</div>

							</div>
						</div>

						<!-- 不开启评级：直接发放奖励 -->
						<div v-else>
							<div class="aui-choice-white b-line coupon-item">
								<div class="aui-flex2">
									<div class="aui-flex-box">现金报酬（￥）</div>
									<!-- @blur="checkMoney($event, 'reward')" -->
									<u-input v-model="form.reward" type="digit" input-align="right" placeholder="请填写报酬"
										@input="calculate()" />
								</div>
								<div class="aui-flex3">
									<div class="u-flex" style="width: 100%;">
										<div class="aui-flex-box">优惠券（￥）</div>
										<u-input v-model="form.couponAmount" type="digit" input-align="right"
											placeholder="请填写优惠券金额" />
									</div>
									<div style="width: 100%;display: flex;flex-direction: row-reverse;">
										<u-radio-group v-model="coupon" @change="radioGroupChange"
											active-color="#eb5468">
											<u-radio v-for="(item, index) in couponList" :key="index" :name="item.name"
												:disabled="item.disabled">
												{{ item.name }}
											</u-radio>
										</u-radio-group>
									</div>
								</div>
							</div>
						</div>

						<!-- 成果交付设置 -->
						<div class="aui-flex aui-choice-white b-line u-center u-font-bold u-pt-15 u-pb-15">
							<u-divider color="#eb5468" fontSize="30" border-color="#eb5468">成果交付设置</u-divider>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">工作报告</div>
							<div class="aui-flex-triangle" @click="enableReport_show = true">{{enableReport_text}}
							</div>
							<u-picker mode="selector" v-model="enableReport_show" :default-selector="[0]"
								:range="selectRange" @confirm="enableReport_text = selectRange[$event]"></u-picker>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">工作素材</div>
							<div class="aui-flex-triangle" @click="enableMaterial_show = true">
								{{enableMaterial_text}}
							</div>
							<u-picker mode="selector" v-model="enableMaterial_show" :default-selector="[0]"
								:range="selectRange" @confirm="enableMaterial_text = selectRange[$event]"></u-picker>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">截图凭证</div>
							<div class="aui-flex-triangle" @click="enableVoucher_show = true">{{enableVoucher_text}}
							</div>
							<u-picker mode="selector" v-model="enableVoucher_show" :default-selector="[0]"
								:range="selectRange" @confirm="enableVoucher_text = selectRange[$event]"></u-picker>
						</div>

						<div class="aui-flex aui-choice-white b-line">
							<div class="aui-flex-box">订单号</div>
							<div class="aui-flex-triangle" @click="enableOrderId_show = true">{{enableOrderId_text}}
							</div>
							<u-picker mode="selector" v-model="enableOrderId_show" :default-selector="[1]"
								:range="selectRange" @confirm="enableOrderId_text = selectRange[$event]"></u-picker>
						</div>



					</div>

				</div>
			</section>

			<div style="height: 30px;"></div>

			<div class="aui-bar-footer">
				<div class="aui-flex-footer">
					<div class="aui-flex-box">
						应付金额：<span>￥{{form.purchasePrice?form.purchasePrice:0.00}}</span>
					</div>
					<div>
						<u-button :disabled="isClick"
							:custom-style="{background:'#f21956',padding:'52rpx 50rpx',color:'#fff',fontSize:'28rpx',borderRadius:'0rpx'}"
							hover-class="none" @click="goToPay">去支付</u-button>
					</div>
				</div>
			</div>

			<!-- 弹窗【截止报名时间不能选择今天以前的日期】 -->
			<u-modal ref="uModal" title="平台提示" v-model="date_show" confirm-text="确认">
				<div class="u-p-20">
					<p>截止报名时间不能选择今天以前的日期，请重新选择。</p>
				</div>
			</u-modal>

			<!-- 弹窗【活动结束时间大于报名截止时间加上提交成果周期】 -->
			<u-modal ref="uModal" title="平台提示" v-model="date_show1" confirm-text="确认">
				<div class="u-p-20">
					<p>“活动结束时间”应大于“报名截止时间”+“提交成果周期”。最好能大于1-2天，预留的时间可用于验收，请重新选择。</p>
				</div>
			</u-modal>

			<!-- 弹窗【评级时间应大于活动结束时间】 -->
			<u-modal ref="uModal" title="平台提示" v-model="date_show2" confirm-text="确认">
				<div class="u-p-20">
					<p>活动结束后方能评级，“评级时间”应大于“活动结束时间”，请重新选择。</p>
				</div>
			</u-modal>

		</section>

		<!-- 选择支付的方式 -->
		<u-popup v-model="pay_show" mode="bottom" @close="closePopup">
			<div class="popup-box">
				<div class="popup-item" v-for="(item, index) in chooseTypes" @click="clickPopup(item)">
					<div>{{item.text}}</div>
				</div>
			</div>
		</u-popup>

	</div>
</template>

<script>
	import globalData from "@/globalData";
	export default {
		data() {
			return {
				goods: {}, // 商品信息
				form: {
					id: '', // 测评任务文档id
					subject: '', // 活动名称
					mainPicture: '', // 活动主图
					label: '', // 标题标签
					quota: 0, // 活动名额
					joinEndTime: '', // 报名截止时间
					submitLimitDays: 3, // 提交成果周期(天)
					open: '0', // 是否公开活动。0否；1是
					endTime: '', // 评级时间
					inspectorId: '', // 验收人员id
					inspectorName: '', // 验收人员昵称
					ratingMemberId: '', // 评级人员id
					ratingMemberName: '', // 评级人员昵称
					openKfid: '', // 品牌推广客服id
					eventParticipants: '', // 活动面向群体
					restrictionLevel: '', // 等级要求
					joinLimitDays: '', // 报名限制周期
					submitConsigneeInfo: '0', // 提交收货信息
					taskRequirements: '', // 推广任务
					taskRequirementsPicture: '', // 推广任务图片
					acceptanceCriteria: '', // 验收标准
					acceptanceCriteriaPicture: '', // 验收标准图片
					enableRating: '0', // 是否开启评级。0:否；1:是；默认0
					levelAQuota: 0, // A级名额
					levelBQuota: 0, // B级名额
					levelCQuota: 0, // C级名额
					levelAReward: 0.00, // A级报酬
					levelBReward: 0.00, // B级报酬
					levelCReward: 0.00, // C级报酬
					levelACouponAmount: 0.00, // A级优惠券金额
					levelBCouponAmount: 0.00, // B级优惠券金额
					levelCCouponAmount: 0.00, // C级优惠券金额
					levelACouponRange: '0', // A级优惠券适用范围。0此商品；1全部商品
					levelBCouponRange: '0', // B级优惠券适用范围。0此商品；1全部商品
					levelCCouponRange: '0', // C级优惠券适用范围。0此商品；1全部商品
					reward: 0.00, // 报酬
					couponAmount: 0.00, // 优惠券金额
					couponRange: '0', // 优惠券适用范围。0此商品；1全部商品
					enableReport: '', // 是否需要填写工作报告。0:不开启；1:开启
					enableMaterial: '', // 是否需要上传工作素材。0:不开启；1:开启
					enableVoucher: '', // 是否需要上传截图凭证。0:不开启；1:开启
					enableOrderId: '', // 是否需要填写订单号。0:不开启；1:开启
					orderId: '', // 支付订单ID
					taskStatus: '1', // 任务状态。0:结束；1:正在进行中
					goodsId: '', // 商品id
					purchasePrice: 0.00, // 应付金额
				},
				isClick: false,
				pay_show: false,
				date_show: false,
				date_show1: false,
				date_show2: false,
				joinEndTime_show: false, // 报名截止时间选择弹窗控制
				endTime_Show: false, // 活动结束时间选择弹窗控制
				ratingTime_Show: false, // 评级时间选择弹窗控制
				userTag: '', // 选择用户标志。0验收人员；1评级人员
				CS_show: false, // 客服选择弹窗控制
				CSRange: [],
				csNameText: '',
				eventParticipants_show: false, // 活动面向群体。0:测评师；1:区域服务商；2:全部用户
				eventParticipantsRange: ['全部用户', '测评师', '区域服务商'],
				eventParticipants_text: '全部用户',
				restrictionLevel_show: false,
				restrictionLevelRange: ['A级', 'B级+', 'C级+', 'D级+', 'E级+', 'F级+'],
				restrictionLevel_text: '请选择', // 等级要求
				joinLimitDays_show: false,
				joinLimitDaysRange: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '15', '22',
					'31'
				], // 默认0
				joinLimitDays_text: '0', // 限制报名周期(天)
				open_show: false,
				open_text: '是', // 是否公开活动
				submitConsigneeInfo_show: false, // 提交收货信息。0:否；1:是；默认0
				submitConsigneeInfo_text: '否',
				enableRating_show: false, // 是否评级发放报酬。0:否；1:是；默认1
				enableRating_text: '否',
				enableRatingRange: [{
						label: '是',
						value: '1'
					},
					{
						label: '否',
						value: '0'
					}
				],
				enableReport_show: false, // 是否需要填写试用报告
				enableReport_text: '是',
				enableMaterial_show: false, // 是否需要上传试用素材
				enableMaterial_text: '是',
				enableVoucher_show: false, // 是否需要上传社交平台截图凭证
				enableVoucher_text: '是',
				enableOrderId_show: false, // 是否需要提交订单好
				enableOrderId_text: '否',
				selectRange: ['是', '否'],
				privilegedStatus: '', // 是否为支付特权人员。yes:是；no:否。默认：no
				chooseTypes: [{
						text: '全额付款',
						action: 'fullPayment'
					},
					{
						text: '支付0.01元',
						action: 'payALittle'
					},
					{
						text: '取消',
						action: 'closePopup'
					}
				],
				couponList: [{
						name: '此商品',
						value: '0',
						disabled: false
					},
					{
						name: '全部商品',
						value: '1',
						disabled: false
					}
				],
				couponA: '此商品',
				couponB: '此商品',
				couponC: '此商品',
				coupon: '此商品',
				mainPictureFiles: [], // 活动主图
				taskRequirementsFiles: [], // 推广任务图片
				acceptanceCriteriaFiles: [], // 验收标准图片
				Navbar: {
					title: '确认订单',
					background: {
						backgroundColor: '#f3e4e9',
					}
				},
			}
		},

		onLoad(options) {
			// 未登录跳转到登录页面
			var loginRes = this.checkLogin()
			if (!loginRes) {
				return false;
			}

			let goods_info = decodeURIComponent(options.goods);
			this.goods = JSON.parse(goods_info);
			this.form.goodsId = this.goods.goodsId;
			console.log("this.goods=", this.goods)

			// 初始化活动名称为商品名称
			this.form.subject = this.goods.goodsName;

			// 初始化测评任务id
			this.getNewId();

			// 初始化数据
			this.initFormData();

			// 初始化微信客服为商品客服
			if (this.isNotNull(this.goods.openKfid)) {
				this.form.openKfid = this.goods.openKfid
			}

			// 获取客服人员列表
			this.getKFRange();

			// 根据userid获取支付特权状态
			this.getPrivilegedStatus();

			// 保存选中的验收/评级人员列表
			uni.$on("saveUserList", (userList = []) => {
				if (userList.length > 0) {
					if (this.userTag == '0') {
						// 验收人员
						this.form.inspectorId = userList[0].Member
						this.form.inspectorName = userList[0].MemberName
					}
					if (this.userTag == '1') {
						// 评级人员
						this.form.ratingMemberId = userList[0].Member
						this.form.ratingMemberName = userList[0].MemberName
					}
				} else {
					this.initFormData();
				}
			});
		},

		methods: {

			/**
			 * 初始化测评任务id
			 */
			async getNewId() {
				let result = await this.$u.api.unifyMiniRestGet({
					systemid: "meily",
					url: "/evaluation/task/getNewId",
					loading: true // 默认发起请求会有一个全局的Loading，设置false可去掉
				});
				if (result.code == 200) {
					this.form.id = result.data
				}
			},

			/**
			 * 初始化 当前用户 为 发起人/验收/评级人员
			 */
			initFormData() {
				const userInfo = uni.getStorageSync('userInfo');

				// 发起人
				this.form.initiatorId = userInfo.userId;
				this.form.initiatorName = userInfo.nickName;
				this.form.avatarUrl = userInfo.avatarUrl;

				// 验收人员默认值为当前用户
				this.form.inspectorId = userInfo.userId
				this.form.inspectorName = userInfo.nickName

				// 评级人员默认值为当前用户
				this.form.ratingMemberId = userInfo.userId
				this.form.ratingMemberName = userInfo.nickName
			},

			/**
			 * 获取客服人员列表
			 */
			async getKFRange() {
				let result = await this.$u.api.unifyMiniRest({
					systemid: "meily",
					url: "/qyapi/kf/account/list/applet",
					name: "品牌",
					loading: false // 默认发起请求会有一个全局的Loading，设置false可去掉
				});
				if (result.code == 200) {
					let rows = result.data;
					if (rows.length > 0) {
						for (let i in rows) {
							let obj = {
								value: rows[i].openKfid,
								label: rows[i].name,
							}
							this.CSRange.push(obj)
						}
						if (this.CSRange.length > 0) {
							this.form.openKfid = this.CSRange[0].value; // 默认选择
							this.csNameText = this.CSRange[0].label;
						}
					}
				}
			},

			/**
			 * 根据userid获取支付特权状态
			 */
			async getPrivilegedStatus() {
				const userInfo = uni.getStorageSync('userInfo')
				let result = await this.$u.api.unifyMiniRestGet({
					systemid: "meily",
					url: "/user/canQuickPay/" + userInfo.userId,
					loading: false // 默认发起请求会有一个全局的Loading，设置false可去掉
				});
				if (result.code == 200) {
					this.privilegedStatus = result.data
				}
			},

			/**
			 * 接收上传组件传过来的值并更新附件列表数据
			 * 获取附件列表（商品主图）
			 */
			async getMainPictureFiles(res) {
				this.mainPictureFiles = res;
			},

			/**
			 * 接收上传组件传过来的值并更新附件列表数据
			 * 获取附件列表（推广任务图片）
			 */
			async getTaskRequirementsFiles(res) {
				this.taskRequirementsFiles = res;
			},

			/**
			 * 接收上传组件传过来的值并更新附件列表数据
			 * 获取附件列表（验收标准图片）
			 */
			async getAcceptanceCriteriaFiles(res) {
				this.acceptanceCriteriaFiles = res;
			},

			// 选中任一radio时，由radio-group触发
			radioGroupChangeA(e) {
				for (let i in this.couponList) {
					if (this.couponList[i].name == e) {
						this.form.levelACouponRange = this.couponList[i].value;
					}
				}
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChangeB(e) {
				for (let i in this.couponList) {
					if (this.couponList[i].name == e) {
						this.form.levelBCouponRange = this.couponList[i].value;
					}
				}
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChangeC(e) {
				for (let i in this.couponList) {
					if (this.couponList[i].name == e) {
						this.form.levelCCouponRange = this.couponList[i].value;
					}
				}
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange(e) {
				for (let i in this.couponList) {
					if (this.couponList[i].name == e) {
						this.form.couponRange = this.couponList[i].value;
					}
				}
			},

			/**
			 * 校验标题标签只能输入四个字
			 * @param {Object} value
			 */
			checkLabel(value) {
				if (value.length > 4) {
					this.form.label = '';
					this.$u.toast("标题标签最多只能输入四个字！");
				}
			},

			/**
			 * 校验各级名额相加不能大于活动名额
			 */
			checkQuota(quota, tag) {
				if (this.form.enableRating == '1') {
					// 需要发放评级报酬是，才需要校验名额
					if (this.isNotNull(this.form.quota)) {
						if (Number(this.form.quota) > 0) {
							let totalQuota = 0;
							if (this.isNotNull(this.form.levelAQuota)) {
								totalQuota += Number(this.form.levelAQuota)
							}
							if (this.isNotNull(this.form.levelBQuota)) {
								totalQuota += Number(this.form.levelBQuota)
							}

							/* if(this.isNotNull(this.form.levelCQuota)){
								totalQuota += Number(this.form.levelCQuota)
							} */

							if (Number(totalQuota) > Number(this.form.quota)) {
								this.$u.toast("A/B级名额相加已超出活动名额，请重新填写！");
								if (tag == 'A') {
									this.form.levelAQuota = 0;
								}
								if (tag == 'B') {
									this.form.levelBQuota = 0;
								}
								/* if(tag == 'C'){
									this.form.levelCQuota = 0;
								} */
							} else {
								// 自动计算C级名额
								this.form.levelCQuota = Number(this.form.quota) - (Number(this.form.levelAQuota) + Number(
									this.form.levelBQuota));
							}
						} else {
							this.$u.toast("请先填写活动名额！");
						}
					}
				}
			},

			/**
			 * 校验是否为金额类型
			 */
			checkMoney(money, tag) {
				if (this.isNotNull(money)) {
					const reg = /^\d+(\.\d{0,2})?$/;
					if (!(reg.test(money))) {
						this.$u.toast("金额只能输入正整数，或最多保留2位小数！");
						if (tag == 'reward') {
							this.form.reward = 0;
						}
						if (tag == 'A') {
							this.form.levelAReward = 0;
						}
						if (tag == 'B') {
							this.form.levelBReward = 0;
						}
						if (tag == 'C') {
							this.form.levelCReward = 0;
						}
					}
				}
			},

			/**
			 * 计算需要支付的金额
			 */
			calculate() {
				let totalAmount = 0.00;
				if (this.form.enableRating == '1') {
					if (this.isNotNull(this.form.levelAQuota) && this.isNotNull(this.form.levelAReward)) {
						totalAmount += parseFloat(this.form.levelAQuota) * parseFloat(this.form.levelAReward);
					}
					if (this.isNotNull(this.form.levelBQuota) && this.isNotNull(this.form.levelBReward)) {
						totalAmount += parseFloat(this.form.levelBQuota) * parseFloat(this.form.levelBReward);
					}
					if (this.isNotNull(this.form.levelCQuota) && this.isNotNull(this.form.levelCReward)) {
						totalAmount += parseFloat(this.form.levelCQuota) * parseFloat(this.form.levelCReward);
					}
				} else if (this.form.enableRating == '0') {
					if (this.isNotNull(this.form.quota) && this.isNotNull(this.form.reward)) {
						totalAmount += parseFloat(this.form.quota) * parseFloat(this.form.reward);
					}
				}
				this.form.purchasePrice = parseFloat(totalAmount).toFixed(2);
			},

			/**
			 * 跳转到商品的详情
			 */
			goToGoodsDetail() {
				this.$u.route('/pages_private_scene2/GroupPurchase/DistributionGoods?goodsId=' + this.goods.goodsId +
					'&goodsNo=' + this.goods.goodsNo);
			},

			/**
			 * 跳转到选人页面（验收人员、评级人员）
			 */
			toSelectUsers(tag) {
				this.userTag = tag;
				let selectUsers = "";
				if (this.userTag == "0") {
					// 验收人员
					selectUsers = this.form.inspectorId
				} else if (this.userTag == "1") {
					// 评级人员
					selectUsers = this.form.ratingMemberId
				}
				this.$u.route('/pages_private_scene2/ProductPromote/common/selectUsers?SceneAssetsId=' + this.goods
					.sceneAssetsId + '&owner=' + uni.getStorageSync('userInfo').userId + '&limit=1&selectUsers=' +
					selectUsers)
			},


			/**
			 * 是否评级发放报酬
			 * @param {Object} event
			 */
			selectEnableRating(event) {
				this.form.enableRating = event[0].value;
				this.enableRating_text = event[0].label;;

				// 重新计算应付金额
				this.calculate();
			},

			/**
			 * 选择客服
			 * @param {Object} e
			 */
			selectCS(event) {
				this.csNameText = event[0].label;
				this.form.openKfid = event[0].value;
			},

			/**
			 * 选择报名截止时间
			 * @param {Object} e
			 */
			async selectJoinEndTime(e) {
				let today = new Date().toLocaleDateString(); // 获取当前日期
				let dateStr = e.year + "-" + e.month + "-" + e.day;
				let diffValue = this.comparisonDate(dateStr, today);
				if (diffValue >= 0) {
					this.form.joinEndTime = dateStr;
					this.calculateRatingDate();
				} else {
					this.date_show = true;
				}
			},

			/**
			 * 自动计算活动结束时间
			 */
			calculateRatingDate() {
				if (this.isNotNull(this.form.joinEndTime)) {
					// 报名截止时间 + 提交成果周期
					this.form.endTime = this.addDate(this.form.joinEndTime, this.form.submitLimitDays);
				}
			},

			/**
			 * 选择活动结束时间
			 * 
			 * 活动结束时间 > 报名截止时间 + 提交测评报告周期
			 * 
			 * @param {Object} e
			 */
			async selectEndTime(e) {
				let joinEndTime = this.form.joinEndTime; // 报名截止时间
				if (!this.isNotNull(joinEndTime)) {
					this.$u.toast("请先选择报名截止时间！");
					return;
				}

				let dateStr = e.year + "-" + e.month + "-" + e.day;

				// 报名截止时间 + 提交成果周期
				joinEndTime = this.addDate(joinEndTime, this.form.submitLimitDays);

				// 活动结束时间 > 报名截止时间 + 提交成果周期
				let diffValue = this.comparisonDate(dateStr, joinEndTime);
				if (diffValue > 0) {
					// 校验通过则赋值
					this.form.endTime = dateStr;
				} else {
					this.date_show1 = true;
				}
			},

			/**
			 * 选择评级时间
			 * 评级时间 > 活动结束时间
			 * @param {Object} e
			 */
			async selectRatingTime(e) {
				if (!this.isNotNull(this.form.endTime)) {
					this.$u.toast("请先选择活动结束时间！");
					return;
				}

				let dateStr = e.year + "-" + e.month + "-" + e.day;

				// 评级时间 > 活动结束时间
				let diffValue = this.comparisonDate(dateStr, this.form.endTime);
				if (diffValue > 0) {
					// 校验通过则赋值
					this.form.ratingTime = dateStr;
				} else {
					this.date_show2 = true;
				}
			},

			/**
			 * 前往付款
			 * 
			 * 1.检验数据
			 * 2.判断是否为后台配置支付特权人员
			 */
			async goToPay() {

				if (this.form.label.length > 4) {
					this.form.label = '';
					this.$u.toast("标题标签最多只能输入四个字！");
					return
				}

				if (!this.isNotNull(this.form.subject)) {
					this.$u.toast("请填写活动名称再提交噢！")
					return
				}

				if (!this.isNotNull(this.form.quota)) {
					this.$u.toast("请填写活动名额再提交噢！")
					return
				}

				if (!this.isNotNull(this.form.joinEndTime)) {
					this.$u.toast("请选择报名截止时间再提交噢！")
					return
				}

				if (!this.isNotNull(this.form.endTime)) {
					this.$u.toast("请选择活动结束时间再提交噢！")
					return
				}
				
				if(this.form.enableRating == '1'){
					if (!this.isNotNull(this.form.ratingTime)) {
						this.$u.toast("请选择评级时间再提交噢！")
						return
					}
				}

				if (!this.isNotNull(this.form.taskRequirements)) {
					this.$u.toast("请填写推广任务再提交噢！")
					return
				}

				if (!this.isNotNull(this.form.acceptanceCriteria)) {
					this.$u.toast("请填写验收标准再提交噢！")
					return
				}

				// 判断是否为后台配置支付特权人员
				if (this.privilegedStatus == "yes") {
					this.pay_show = true; // 是，则可以选择支付额度
				} else {
					this.doWxPay('fullPayment'); // 否，全额付款
				}
			},

			/**
			 * 选择支付的方式
			 */
			async clickPopup(item) {
				if (item.action == 'fullPayment' || item.action == 'payALittle') {
					this.doWxPay(item.action);
				} else if (item.action == 'closePopup') {
					this.pay_show = false
				}
			},

			/**
			 * 关闭 选择支付的方式
			 */
			closePopup() {
				this.pay_show = false;
			},

			/**
			 * 支付
			 */
			async doWxPay(action) {

				// ----------start---------组装数据-----------start-------------------


				// 主图
				let mainPicture = ''
				for (const i in this.mainPictureFiles) {
					if (mainPicture == '') {
						mainPicture = this.mainPictureFiles[i].url
					} else {
						mainPicture += "," + this.mainPictureFiles[i].url
					}
				}
				this.form.mainPicture = mainPicture;

				if (this.submitConsigneeInfo_text == '是') {
					this.form.submitConsigneeInfo = '1';
				} else if (this.submitConsigneeInfo_text == '否') {
					this.form.submitConsigneeInfo = '0';
				}

				// 测评等级要求
				if (this.restrictionLevel_text == 'A级') {
					this.form.restrictionLevel = 'A';
				} else if (this.restrictionLevel_text == 'B级+') {
					this.form.restrictionLevel = 'B';
				} else if (this.restrictionLevel_text == 'C级+') {
					this.form.restrictionLevel = 'C';
				} else if (this.restrictionLevel_text == 'D级+') {
					this.form.restrictionLevel = 'D';
				} else if (this.restrictionLevel_text == 'E级+') {
					this.form.restrictionLevel = 'E';
				} else if (this.restrictionLevel_text == 'F级+') {
					this.form.restrictionLevel = 'F';
				} else {
					this.form.restrictionLevel = '';
				}

				// 活动面向群体。0:测评师；1:区域服务商；2:全部用户
				if (this.eventParticipants_text == '测评师') {
					this.form.eventParticipants = '0';
				} else if (this.eventParticipants_text == '区域服务商') {
					this.form.eventParticipants = '1';
				} else {
					this.form.eventParticipants = '2';
				}

				// 是否需要填写试用报告
				if (this.enableReport_text == '是') {
					this.form.enableReport = '1';
				} else {
					this.form.enableReport = '0';
				}

				// 是否需要上传试用素材
				if (this.enableMaterial_text == '是') {
					this.form.enableMaterial = '1';
				} else {
					this.form.enableMaterial = '0';
				}

				// 是否需要上传截图凭证
				if (this.enableVoucher_text == '是') {
					this.form.enableVoucher = '1';
				} else {
					this.form.enableVoucher = '0';
				}

				// 是否需要填写订单号
				if (this.enableOrderId_text == '是') {
					this.form.enableOrderId = '1';
				} else {
					this.form.enableOrderId = '0';
				}

				// 是否公开活动
				if (this.open_text == '是') {
					this.form.open = '1';
				} else {
					this.form.open = '0';
				}

				// 支付订单ID
				this.form.orderId = this.guid(); // 商户订单号。可自定义也可让系统自动生成

				// ----------end---------组装数据-----------end-------------------

				if (!this.isNotNull(this.form.purchasePrice)) {
					this.$u.toast("应付金额为空，无法支付！");
					return;
				}

				// 显示 loading 提示框
				uni.showLoading({
					mask: true,
				});

				// 设置按钮为不可点击
				this.isClick = true;

				// 0.初始化订单信息
				// 格式化名字（名字超长处理）--- 暂不处理
				let Subject = this.formatSubject(this.form.subject, 25);

				let name = Subject + "-预存测评费用";
				let price = 0;

				if (action == 'fullPayment') {
					console.log("********全额付款***********");
					price = parseFloat(this.form.purchasePrice) * 100; // 全额付款
				}
				if (action == 'payALittle') {
					console.log("********支付0.01元***********");
					price = 1; // 支付一分钱
				}

				// 定义商品信息串，建议这些字段定义规范并且固定（例如商品件数等数据），好方便订单系统进行展示
				let goodsInfo = {};
				goodsInfo.goodsNum = '1件'; // 件数
				goodsInfo.goodsWeight = '0kg'; // 重量

				// 定义商家信息串，建议这些字段定义规范并且固定（例如下面这两个字段），好方便订单系统进行展示
				let mchInfo = {};
				mchInfo.mchname = this.goods.MerchantName; // 商家名称
				mchInfo.mchimage = this.goods.MerchantIcon; // 商家图标

				let obj = {};
				obj.userid = uni.getStorageSync('userInfo').userId;
				obj.openid = uni.getStorageSync('userInfo').openid;
				obj.tradeDesc = name;
				obj.payPrice = price; // 付款金额
				obj.productID = this.goods.goodsNo; // 商品编号
				obj.productUrl = ''; // 订单详情页地址
				obj.imageUrl = this.goods.goodsImages.split(',')[0]; // 商品图片
				obj.goodsInfo = goodsInfo;
				obj.mchInfo = mchInfo;
				obj.remark = name;
				obj.tradeNo = this.form.orderId;

				let orderExtJson = {
					type: 4, // 发起测评
					data: this.form // 业务数据
				}
				obj.orderExtJson = JSON.stringify(orderExtJson);

				// 1.调用微信支付接口鉴权，返回鉴权信息
				let authinfo = await this.geAuthInfo(obj);
				console.info("支付接口1.authinfo=", authinfo);
				if (authinfo.code != 200) {
					console.log("鉴权失败：" + authinfo);
					this.showMSG('error', '支付失败！');
					this.isClick = false; // 设置按钮为可点击
					return;
				}

				// 2.调用 小程序支付统一接口，这里是以url判断是哪个接口的
				let url = "/api/unifiedorder";
				let respJson = await this.postWxpayServer(url, obj, authinfo);
				console.info("支付接口2.respJson=", respJson);
				if (respJson.code != 200) {
					console.log("调用小程序支付统一接口失败：" + respJson.msg);
					this.showMSG('error', '支付失败！');
					this.isClick = false; // 设置按钮为可点击
					return;
				}

				// 3.开始发起支付动作
				let paymentdata = respJson.data;
				console.log("支付接口3.paymentdata=", paymentdata);
				// hasNext：true表示要发起微信支付，false表示已支付成功
				if (!paymentdata.hasNext) {
					// 0元支付成功（表示写支付记录成功，并未真的进行支付）
					console.log("0元支付成功");
					/**
					 * 延时查询业务是否处理成功；
					 * 1.处理成功，则跳转到订单详情
					 * 2.处理未成功，则提示出错了
					 */
					setTimeout(() => {
						// 根据订单id判断后端是否已经处理好业务
						this.getActivityDetails(this.form.orderId);
					}, 1500);
					return;
				}

				// 开始发起支付动作，进入到这里表示 hasNext = true，需要调用发起微信支付*/
				let that = this;
				let payTag = ''; // 记录是否支付成功。0:未支付成功；1:支付成功
				wx.requestPayment({
					...paymentdata,
					success(res) {
						// 此处只能返回通信成功，返回的并不是支付成功，只能在complete中进行业务处理
						console.log("支付成功", res);
						payTag = '1'; // 支付成功
					},
					fail(err) {
						console.log("支付失败", err);
						// that.showMSG('error', '支付失败！');
						that.pay_show = false; // 关闭 选择支付的方式
						that.isClick = false; // 设置按钮为可点击
						payTag = '0'; // 支付失败
					},
					complete(res) {
						/**
						 * 延时查询业务是否处理成功；
						 * 1.业务处理成功，则跳转到报名页面
						 * 2.业务处理未成功，则提示出错了
						 */
						if (payTag == '1') { // 支付成功才会执行
							setTimeout(() => {
								// 根据订单id判断后端是否已经处理好业务
								that.getActivityDetails(that.form.orderId);
							}, 1500);
						}
					}
				});
			},

			/**
			 * 根据订单id判断后端是否已经处理好业务
			 */
			async getActivityDetails(orderId) {
				let result = await this.$u.api.unifyMiniRestGet({
					systemid: "meily",
					url: "/evaluation/task/info/byOrderId/" + orderId,
					loading: true // 默认发起请求会有一个全局的Loading，设置false可去掉
				});
				if (result.code == 200) {
					if (result.data && this.isNotNull(result.data.id)) {
						// 1.处理成功，则跳转到报名页面
						uni.reLaunch({
							url: '/pages_private_scene1/evaluation/sign_up?docUnid=' + result.data.id
						});
					} else {
						// 2.处理未成功，则提示出错了
						this.showMSG('error', "出错了！");
					}
				} else {
					this.$u.toast(result.msg)
				}
			},

			/**
			 * 格式化订单名字（名字超长处理）
			 * name：需要处理的字段
			 * MaxLength：要保留的最大长度，包含...
			 */
			formatSubject(name, MaxLength) {
				let cutName = "";
				if (name.length > MaxLength) {
					// 超出的长度，需要截取
					let cutLength = name.length - (name.length - MaxLength) - 3; // 3表示三个省略号的长度
					cutName = name.substring(0, cutLength) + "...";
				} else {
					cutName = name;
				}
				return cutName;
			},

		}
	}
</script>

<style scoped>
	aui-flexView {
		width: 100%;
		height: 100%;
		margin: 0 auto;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-orient: vertical;
		-webkit-box-direction: normal;
		-webkit-flex-direction: column;
		-ms-flex-direction: column;
		flex-direction: column;
	}

	.aui-scrollView {
		width: 100%;
		height: 100%;
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		-ms-flex: 1;
		flex: 1;
		overflow-y: auto;
		overflow-x: hidden;
		-webkit-overflow-scrolling: touch;
		position: relative;
		margin-top: 0;
	}

	.aui-navBar {
		height: 44px;
		position: relative;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		z-index: 1002;
		background: #f7f7f7;
	}

	.b-line {
		position: relative;
	}

	.b-line:after {
		content: '';
		position: absolute;
		z-index: 2;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 1px;
		border-bottom: 1px solid #e2e2e2;
		-webkit-transform: scaleY(0.5);
		transform: scaleY(0.5);
		-webkit-transform-origin: 0 100%;
		transform-origin: 0 100%;
	}

	.aui-navBar-item {
		height: 44px;
		min-width: 25%;
		-webkit-box-flex: 0;
		-webkit-flex: 0 0 25%;
		-ms-flex: 0 0 25%;
		flex: 0 0 25%;
		padding: 0 0.9rem;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		-ms-flex-align: center;
		align-items: center;
		font-size: 0.7rem;
		white-space: nowrap;
		overflow: hidden;
		color: #353535;
		position: relative;
	}

	.aui-navBar-item:first-child {
		-webkit-box-ordinal-group: 2;
		-webkit-order: 1;
		-ms-flex-order: 1;
		order: 1;
		margin-right: -25%;
		font-size: 0.9rem;
		font-weight: bold;
	}

	.aui-navBar-item:last-child {
		-webkit-box-ordinal-group: 4;
		-webkit-order: 3;
		-ms-flex-order: 3;
		order: 3;
		-webkit-box-pack: end;
		-webkit-justify-content: flex-end;
		-ms-flex-pack: end;
		justify-content: flex-end;
	}

	.aui-center {
		-webkit-box-ordinal-group: 3;
		-webkit-order: 2;
		-ms-flex-order: 2;
		order: 2;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-pack: center;
		-webkit-justify-content: center;
		-ms-flex-pack: center;
		justify-content: center;
		-webkit-box-align: center;
		-webkit-align-items: center;
		-ms-flex-align: center;
		align-items: center;
		height: 44px;
		width: 50%;
		margin-left: 25%;
	}

	.aui-center-title {
		text-align: center;
		width: 100%;
		white-space: nowrap;
		overflow: hidden;
		display: block;
		text-overflow: ellipsis;
		font-size: 0.95rem;
		color: #333;
	}

	.icon {
		width: 20px;
		height: 20px;
		display: block;
		border: none;
		float: left;
		background-size: 20px;
		background-repeat: no-repeat;
	}

	.aui-flex {
		width: 90%;
		margin: 0 auto;
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		padding: 30rpx 0;
		position: relative;
	}

	.aui-flex4 {
		margin: 0 auto;
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		padding: 30rpx 0;
		position: relative;
	}

	.aui-flex-box {
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		flex: 1;
		min-width: 0;
		font-size: 14px;
		color: #333;
	}

	.aui-flex-triangle {
		position: relative;
		font-size: 14px;
		padding-right: 15px;
	}

	.aui-flex-triangle:before {
		content: '';
		width: 0;
		height: 0;
		border-width: 5px 0px 5px 8px;
		border-style: solid;
		border-color: transparent transparent transparent #7b7b7b;
		position: absolute;
		top: 6px;
		right: 0;
		border-radius: 1;
	}

	.aui-choice-white {
		background: #fff;
	}

	.aui-order-box {
		padding: 20rpx 0rpx;
	}

	.aui-flex-goods {
		margin-right: .8em;
		width: 80px;
		height: 80px;
		line-height: 80px;
		text-align: center;
	}

	.aui-flex-goods img {
		width: 100%;
		max-height: 100%;
		vertical-align: top;
	}

	.aui-flex-default {
		background: #ffffff;
	}

	.aui-flex-default h2 {
		font-size: 14px;
		width: auto;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		word-wrap: normal;
		word-wrap: break-word;
		word-break: break-all;
		padding-bottom: 5px;
	}

	.aui-flex-default p {
		color: #999999;
		font-size: 12px;
	}

	.aui-flex-clear {
		padding: 0;
		margin-top: 20rpx;
	}

	.aui-flex-clear .aui-flex-box {
		color: #f21956;
		font-weight: bold;
	}

	.aui-mar15 {
		margin-bottom: 15px;
	}

	.aui-flex-triangle-clear:before {
		border-color: #fff;
	}

	.aui-flex-box h2 {
		font-size: 16px;
		padding-bottom: 5px;
	}

	.aui-flex-box h3 {
		font-size: 14px;
		padding-bottom: 5px;
	}

	.aui-flex-box p {
		font-size: 12px;
		color: #999;
		line-height: 1.2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
	}

	.aui-bar-footer {
		line-height: 52px;
		height: 52px;
		background: #fff;
		box-shadow: 0 -2px 10px #ddd;
		position: fixed;
		z-index: 999;
		bottom: 0;
		left: 0;
		width: 100%;
	}

	.aui-btn-button {
		background: #f21956;
		padding: 0 25px;
		color: #fff;
		font-size: 14px;
	}

	.aui-bar-footer .aui-flex {
		padding: 0;
	}

	.aui-bar-footer .aui-flex-box {
		padding-left: 15px;
	}

	.aui-bar-footer .aui-flex-box span {
		font-style: normal;
		color: #f21956;
	}

	.cnt {
		padding-top: 1px;
		color: #e61111;
		position: relative;
		line-height: 22px;
		font-size: 14px;
		font-weight: 500;
	}

	.popup-box {
		padding-bottom: 50rpx;
		padding-top: 50rpx;
	}

	.popup-item {
		height: 100rpx;
		line-height: 100rpx;
		text-align: center;
		font-size: 33rpx;
	}

	.discount_info {
		border-bottom: 1px solid black;
		border-left-width: 0;
		border-top-width: 0;
		border-right-width: 0;
		width: 50px;
		height: 30px;
		text-align: center;
		padding-left: 15px;
	}

	.swipe-content {
		display: flex;
		flex-direction: row;
		background: #fff;
		border-bottom: 1rpx solid #eee;
		line-height: 35px;
	}

	.richtext-block {
		background: #f3f3f3;
		width: 100%;
		margin: 0 auto;
		border-radius: 5px;
		padding: 20rpx;
		height: 540rpx;
	}

	.aui-flex-tags {
		width: 435rpx;
		text-align: left;
	}

	.mod-richtext {
		padding: 15px;
		height: 450px;
		overflow-y: scroll;
	}

	.Tips {
		font-size: 20rpx;
		line-height: 24rpx;
		margin-top: 12rpx;
		color: #9a9a9a;
		/* padding: 30rpx;
		margin: 0; */
		word-break: break-all;
		-webkit-overflow-scrolling: touch;
		-webkit-tap-highlight-color: transparent;
		text-size-adjust: 100%;
		box-sizing: border-box;
	}

	.textarea-block {
		background: #f5f5f5;
		width: 93%;
		/* margin: 0 auto; */
		border-radius: 5px;
		padding: 20rpx;
		height: 11.5rem;
		user-select: text !important;
		-webkit-user-select: text;
	}

	.textarea-block textarea {
		width: 100%;
		padding: 1rem;
		font-size: 0.95rem;
		overflow: hidden;
		resize: none;
		height: 8rem;
		border: none;
		background: none;
		line-height: 1.8;
	}

	.aui-flex-box-title {
		padding: 30rpx 0 30rpx 0;
		font-size: 32rpx;
		font-weight: bold;
	}

	.aui-flex2 {
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		padding: 0rpx 0rpx 30rpx 0rpx;
		position: relative;
	}

	.aui-flex3 {
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		flex-direction: column;
		padding: 0rpx 0rpx 30rpx 0rpx;
		position: relative;
	}

	.coupon-item {
		width: 90%;
		margin: 0 auto;
	}

	.border-radius30 {
		border-radius: 30rpx;
	}

	.aui-flex-goodsbox {
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		padding: 30rpx 40rpx;
		position: relative;
		border-radius: 30rpx;
	}

	.goods-box-price {
		color: #f21956;
		font-size: 36rpx;
		font-weight: bold;
	}

	.goods-box-spec {
		color: #9f9d9e;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.aui-flex-footer {
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		position: relative;
	}
</style>